<?php
class Book extends EnhancedModel {
    static $attr_protected = array("id","created_at","updated_at");

    static $validates_presence_of = array(
        array('title'),
    );

    static $validates_numericity_of = array(
        array('price'),
        array('on_stock','only_integer'=> true)
    );

    static $belongs_to = array(
        array('category','class_name'=>'BookCategory','foreign_key' => 'category_id')
    );

    static $has_many = array(
        array('reviews'),
        array('carts')
    );
}
?>
